package aspect;

import java.util.List;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.exceptions.JedisException;
import util.DateParseUtil;
import util.PropertieUtil;

@Aspect
@Component
public class MethodLoggingAspect {
	
	@Autowired
	@Qualifier("lockRedisTemplate")
	RedisTemplate<Object, Object> redisTemplate;
	
	private static final String rHash = "fcountHash";
	
	/**
	 * AOP 统计日志
	 * 所有service访问情况 记录在 redis(db_index 1) 哈希
	 * made by 帅南
	 * @param point
	 */
	 public void logging(JoinPoint point)  {
//		 String fName = point.getSignature().toString();
//		 if(redisTemplate.hasKey(rHash)){
//			 if(redisTemplate.opsForHash().hasKey(rHash, fName)){
//				 redisTemplate.opsForHash().increment(rHash, fName, 1);
//			 }else{
//				 redisTemplate.opsForHash().put(rHash, fName, 1);
//			 }
//		 }else{
//			 redisTemplate.opsForHash().put(rHash, fName, 1);
//		 }
	 }
	
}
